package starblaze 
{
  import starblaze.error.DuplicateVariableError;
	
  public final class VariableRegistrar 
  {
    
    internal var m_registry:Vector.<Variable> = new Vector.<Variable>();
    
    private var m_numBytes:uint = 0;
    public function get numBytes():uint { return m_numBytes; }
    
    public function register(variable:Variable):void
    {
      for each (var v:Variable in m_registry)
        if (v.name == variable.name)
          throw new DuplicateVariableError(variable);
          
      m_registry.push(variable);
      m_numBytes += variable.type.numBytes;
    }
    
  }

}
